package project2;

/*
* 2019-11-21
* 自顶向下的归并排序
* 需要1/2nlgn——nlgn次比较，访问6nlgn次数组
* */
public class TDM {
    private Merge m = new Merge();
    public void sort(int[] a){
        m.aux = new int[a.length];
        sort(a, 0, a.length-1);
    }
    public void sort(int[] a, int lo, int hi){
        if(hi <= lo) return;
        int mid = (lo + ((hi-lo)>>>1));
        sort(a, lo, mid);
        sort(a, mid+1, hi);
        m.merge(a, lo, mid,hi);
    }
}
